<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
	<xsl:template name="get-control-point">
		<xsl:choose>
			<xsl:when test="type='label'">12, <xsl:value-of select="(line_index*26)-14"/></xsl:when>
			<xsl:when test="type='check'">12, <xsl:value-of select="(line_index*26)-17"/></xsl:when>
			<xsl:otherwise>120, <xsl:value-of select="(line_index*26)-17"/></xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="get-control-type">
		<xsl:choose>
			<xsl:when test="type='label'">DevExpress.XtraEditors.LabelControl</xsl:when>
			<xsl:when test="type='text'">DevExpress.XtraEditors.TextEdit</xsl:when>
			<xsl:when test="type='date'">DevExpress.XtraEditors.DateEdit</xsl:when>
			<xsl:when test="type='check'">DevExpress.XtraEditors.CheckEdit</xsl:when>
			<xsl:when test="type='combo'">DevExpress.XtraEditors.ComboBoxEdit</xsl:when>
			<xsl:when test="type='lookup'">DevExpress.XtraEditors.ButtonEdit</xsl:when>
			<xsl:when test="type='combolookup'">DevExpress.XtraEditors.ComboBoxEdit</xsl:when>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="get-control-name">
		<xsl:choose>
			<xsl:when test="type='label'">lbl</xsl:when>
			<xsl:when test="type='text'">txt</xsl:when>
			<xsl:when test="type='date'">dte</xsl:when>
			<xsl:when test="type='check'">chk</xsl:when>
			<xsl:when test="type='combo'">cbe</xsl:when>
			<xsl:when test="type='lookup'">bte</xsl:when>
			<xsl:when test="type='combolookup'">cbe</xsl:when>
		</xsl:choose>
		<xsl:value-of select="name"/>
	</xsl:template>
<xsl:template match="/editform">namespace <xsl:value-of select="root_namespace"/>.Forms.Edit
{
    partial class <xsl:value-of select="table_class_name"/><![CDATA[EditForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>]]>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.dxErrorProvider1 = new DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider(this.components);
            <xsl:for-each select="control">
            this.<xsl:call-template name="get-control-name"/> = new <xsl:call-template name="get-control-type"/>();
            </xsl:for-each>((System.ComponentModel.ISupportInitialize)(this.dxErrorProvider1)).BeginInit();
            <xsl:for-each select="control[type!='label']">((System.ComponentModel.ISupportInitialize)(this.<xsl:call-template name="get-control-name"/>.Properties)).BeginInit();
            </xsl:for-each>this.SuspendLayout();
            // 
            // cmdSave
            // 
            this.cmdSave.Location = new System.Drawing.Point(123, <xsl:value-of select="(edit_control_count - 1)*26 + 45"/>);
            this.cmdSave.TabIndex = 250;
            // 
            // cmdCancel
            // 
            this.cmdCancel.Location = new System.Drawing.Point(204, <xsl:value-of select="(edit_control_count - 1)*26 + 45"/>);
            this.cmdCancel.TabIndex = 251;
            // 
            // dxErrorProvider1
            // 
            this.dxErrorProvider1.ContainerControl = this;
            <xsl:for-each select="control">
            // 
            // <xsl:call-template name="get-control-name"/>
            // 
            this.<xsl:call-template name="get-control-name"/>.Location = new System.Drawing.Point(<xsl:call-template name="get-control-point"/>);
            this.<xsl:call-template name="get-control-name"/>.Name = "<xsl:call-template name="get-control-name"/>";
            this.<xsl:call-template name="get-control-name"/>.Size = new System.Drawing.Size(<xsl:choose><xsl:when test="type='label'">75, 13</xsl:when><xsl:otherwise>159, 20</xsl:otherwise></xsl:choose>);
            this.<xsl:call-template name="get-control-name"/>.TabIndex = <xsl:value-of select="tabindex*5"/>;
            <xsl:choose>
            <xsl:when test="type='label'">
            this.<xsl:call-template name="get-control-name"/>.Text = "<xsl:value-of select="label"/>";
            </xsl:when>
            <xsl:when test="type='check'">
            this.<xsl:call-template name="get-control-name"/>.Properties.AutoWidth = true;
            this.<xsl:call-template name="get-control-name"/>.Properties.Caption = "<xsl:value-of select="label"/>";
            </xsl:when>
            <xsl:when test="type='date'">
            this.<xsl:call-template name="get-control-name"/>.EditValue = null;
            this.<xsl:call-template name="get-control-name"/>.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
              new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.<xsl:call-template name="get-control-name"/>.Properties.VistaTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
              new DevExpress.XtraEditors.Controls.EditorButton()});
            </xsl:when>
            <xsl:when test="type='combo'">
            this.<xsl:call-template name="get-control-name"/>.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
              new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.<xsl:call-template name="get-control-name"/>.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            </xsl:when>				
            <xsl:when test="type='lookup'">
            this.<xsl:call-template name="get-control-name"/>.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
              new DevExpress.XtraEditors.Controls.EditorButton()});
            this.<xsl:call-template name="get-control-name"/>.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            </xsl:when>
            </xsl:choose>
            </xsl:for-each>
            // 
            // <xsl:value-of select="table_class_name"/>EditForm
            // 
            this.AcceptButton = this.cmdSave;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(291, <xsl:value-of select="(edit_control_count - 1)*26 + 80"/>);
            <xsl:for-each select="control">this.Controls.Add(this.<xsl:call-template name="get-control-name"/>);
            </xsl:for-each>this.Name = "<xsl:value-of select="table_class_name"/>EditForm";
            this.Text = "<xsl:value-of select="table_class_name"/>";
            <xsl:for-each select="control">this.Controls.SetChildIndex(this.<xsl:call-template name="get-control-name"/>, 0);
            </xsl:for-each>((System.ComponentModel.ISupportInitialize)(this.dxErrorProvider1)).EndInit();
            <xsl:for-each select="control[type!='label']">((System.ComponentModel.ISupportInitialize)(this.<xsl:call-template name="get-control-name"/>.Properties)).EndInit();
            </xsl:for-each>
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider dxErrorProvider1;
        <xsl:for-each select="control">private <xsl:call-template name="get-control-type"/><xsl:text> </xsl:text><xsl:call-template name="get-control-name"/>;
        </xsl:for-each>
     }
}
</xsl:template>
</xsl:stylesheet>